package site.teamo.biu.flink.common.dataflow.descriptor;

import com.alibaba.fastjson2.JSON;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * @author haocongshun
 * @date 2023/11/03 15:41:17
 */
@Data
@Accessors(chain = true)
public class DataFlowDescriptor {
    private String id;
    private String name;
    List<NodeDescriptor> nodes;
    List<ConnectorDescriptor> connectors;

    public static DataFlowDescriptor generate(String id, String name, String content) {
        DataFlowDescriptor dataFlowDescriptor = JSON.parseObject(content, DataFlowDescriptor.class);
        dataFlowDescriptor.setId(id);
        dataFlowDescriptor.setName(name);
        return dataFlowDescriptor;
    }
}
